<script>
import { ref } from 'vue'
</script>

<template>
  <div class="home-container">
    <h1>欢迎使用听友音乐曲库管理系统</h1>
    <div class="dashboard-grid">
      <div class="dashboard-card">
        <h3>音乐库统计</h3>
        <div class="stat">总歌曲数：{{ stats.totalSongs }}</div>
        <div class="stat">总专辑数：{{ stats.totalAlbums }}</div>
        <div class="stat">总艺术家数：{{ stats.totalArtists }}</div>
      </div>
      <div class="dashboard-card">
        <h3>最近添加</h3>
        <ul class="recent-list">
          <li v-for="item in recentItems" :key="item.id">
            {{ item.name }}
          </li>
        </ul>
      </div>
      <div class="dashboard-card">
        <h3>快速操作</h3>
        <div class="quick-actions">
          <router-link to="/music-library" class="action-btn">浏览音乐库</router-link>
          <router-link to="/playlists" class="action-btn">管理播放列表</router-link>
        </div>
      </div>
    </div>
  </div>
</template>

<style scoped>
.home-container {
  padding: 2rem;
}

h1 {
  color: #2c3e50;
  margin-bottom: 2rem;
  text-align: center;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.dashboard-card {
  background-color: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

h3 {
  color: #2c3e50;
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

.stat {
  margin-bottom: 0.5rem;
  color: #666;
}

.recent-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.recent-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid #eee;
  color: #666;
}

.recent-list li:last-child {
  border-bottom: none;
}

.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.action-btn {
  display: block;
  padding: 0.75rem;
  background-color: #2c3e50;
  color: white;
  text-decoration: none;
  border-radius: 4px;
  text-align: center;
  transition: background-color 0.3s;
}

.action-btn:hover {
  background-color: #34495e;
}
</style>
